<script setup>
import {ref} from "vue";

const date = ref('')
const times = ref([])
const f = () => {
  console.log(times.value)
  console.log(times.value[0])
  console.log(times.value[1])
}
</script>

<template>
  <h1>日期时间选择器组件</h1>
  <el-date-picker type="date" v-model="date" @change="console.log(date)" value-format="YYYY-MM-DD" format="YYYY-MM-DD">
  </el-date-picker>
  <hr>
  <el-date-picker
      type="datetimerange"
      format="YYYY-MM-DD HH:mm:ss"
      value-format="YYYY-MM-DD HH:mm:ss"
      v-model="times"
      @change="f"
      start-placeholder="开始日期"
      end-placeholder="结束日期"
      range-separator="至"
  >
  </el-date-picker>
</template>

<style scoped>

</style>